package org.opens.emp.controller;

import org.opens.util.R;
import org.opens.emp.entity.EmpEntity;
import org.opens.emp.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/emp")
public class EmpController {

    @Autowired
    private EmpService empService;

    @RequestMapping(value = "/save")
    public R<EmpEntity> save(@RequestBody EmpEntity empEntity) {
        return R.success(empService.save(empEntity));
    }

    @RequestMapping(value = "/getById/{id}")
    public R<EmpEntity> getById(@PathVariable(value = "id") String id) {
        return R.success(empService.getById(id));
    }

}
